// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
// import { bxAnaalyse } from '@/core/icons'
// 引入render函数
const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'dashboard',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    // 重定向
    redirect: '/dashboard/workplace',
    children: [
      // dashboard
      {
        path: '/dashboard/workplace',
        name: 'Workplace',
        component: () => import('@/views/dashboard/Workplace'),
        meta: { title: 'menu.dashboard.workplace', keepAlive: true, permission: ['dashboard'] }
      },
      // profile
      {
        path: '/profile',
        name: 'ProfileAdvanced',
        component: () => import('@/views/profile/advanced/Advanced'),
        redirect: '/profile/advanced',
        meta: { title: 'menu.profile.advanced', icon: 'profile', permission: ['profile'] },
        children: [
          {
            path: '/profile/advanced/article',
            name: 'SearchArticlesA',
            component: () => import('../views/profile/advanced/Article'),
            meta: { title: 'menu.list.search-list.articles', permission: ['table'] }
          },
          {
            path: '/profile/advanced/project',
            name: 'SearchProjectsB',
            component: () => import('../views/profile/advanced/Projects'),
            meta: { title: 'menu.list.search-list.projects', permission: ['table'] }
          },
          {
            path: '/profile/advanced/application',
            name: 'SearchApplicationsC',
            component: () => import('../views/profile/advanced/Applications'),
            meta: { title: 'menu.list.search-list.applications', permission: ['table'] }
          }
        ]
      },
      // taskManagement
      {
        path: '/taskManagement',
        redirect: '/taskManagement/gatherTask',
        component: RouteView,
        meta: { title: 'menu.form', icon: 'form', permission: ['form'] },
        children: [
          {
            path: '/taskManagement/gatherTask',
            name: 'gatherTask',
            children: [
              {
                path: '/taskManagement/gatherTask/taskAwaited',
                name: 'taskAwaited',
                component: () => import('@/views/taskManagement/gatherTask/taskAwaited'),
                meta: { title: 'menu.list.search-list.articles', permission: ['table'] }
              },
              {
                path: '/taskManagement/gatherTask/taskChecked',
                name: 'taskChecked',
                component: () => import('@/views/taskManagement/gatherTask/taskChecked'),
                meta: { title: 'menu.list.search-list.projects', permission: ['table'] }
              }
            ]
          },
          {
            path: '/taskManagement/teachTask',
            name: 'teachTask',
            component: () => import('@/views/taskManagement/teachTask/taskResult')
          }
        ]
      },
      // statementManagement
      {
        path: '/statementManagement',
        name: 'statement',
        component: RouteView,
        redirect: '/statementManagement/statement',
        meta: { title: 'menu.list', icon: 'table', permission: ['table'] },
        children: [
          {
            path: '/statementManagement/statement/words',
            name: 'WordsManage',
            // hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/statementManagement/statement/words'),
            meta: { title: 'menu.list.table-list', keepAlive: true, permission: ['table'] }
          },
          {
            path: '/statementManagement/statement/statements',
            name: 'StatementsManage',
            component: () => import('@/views/statementManagement/statement/statements'),
            meta: { title: 'menu.list.basic-list', keepAlive: true, permission: ['table'] }
          }
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    // 重定向
    redirect: '/user/login',
    // 标志位：不渲染
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
